package com.mr.qa.dao.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mr.qa.bo.ShopArticleHistory;

public class ShopArticleHistoryDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory.getLog(ShopArticleHistoryDAO.class);
	public void save(ShopArticleHistory transientInstance) 
    {
        try 
        {
            getSession().save(transientInstance);
        }
        catch(RuntimeException re) 
        {
            throw re;
        }
    }
	
	public void modify(ShopArticleHistory transientInstance) 
    {
        try 
        {
            getSession().update(transientInstance);
        }
        catch(RuntimeException re) 
        {
            throw re;
        }
    }

    
    public void delete(ShopArticleHistory persistentInstance) 
    {
        log.debug("deleting ShopArticleHistory instance");
        try 
        {
            getSession().delete(persistentInstance);
            log.debug("delete successful");
        }
        catch (RuntimeException re) 
        {
            log.error("delete failed", re);
            throw re;
        }
    }
    
    public Integer countHistory(String whereClause){
    	StringBuffer sql = new StringBuffer("select count(*) from ShopArticleHistory");
    	if(whereClause != null){
    		sql.append(" " + whereClause);
    	}
    	return this.countQuery(sql.toString(), null);
    }
    
    public List getHistoryList(String whereClause, String orderClause){
    	StringBuffer sql = new StringBuffer("from ShopArticleHistory");
    	if(whereClause != null){
    		sql.append(" " + whereClause);
    	}
    	if(orderClause != null){
    		sql.append(" " + orderClause);
    	}
    	return this.getQueryList(sql.toString(), null);
    }
}
